    var AlibabaCloudPlugin = function() {}

    // private plugin function

    // AlibabaCloudPlugin.prototype.receiveMessage = {}
    // AlibabaCloudPlugin.prototype.openNotification = {}
    // AlibabaCloudPlugin.prototype.receiveNotification = {}

    AlibabaCloudPlugin.prototype.isPlatformIOS = function() {
        var isPlatformIOS = device.platform == 'iPhone' ||
            device.platform == 'iPad' ||
            device.platform == 'iPod touch' ||
            device.platform == 'iOS'
        return isPlatformIOS
    }

    AlibabaCloudPlugin.prototype.error_callback = function(msg) {
        console.log('Javascript Callback Error: ' + msg)
    }

    AlibabaCloudPlugin.prototype.call_native = function(name, args, callback) {
        ret = cordova.exec(callback, this.error_callback, 'AlibabaCloudPushPlugin', name, args)
        return ret
    }

    AlibabaCloudPlugin.prototype.initCloudPush = function(callback) {
        var data = [];
        this.call_native('initCloudPush', data, callback);
    }

    AlibabaCloudPlugin.prototype.registerAccount = function(account, callback) {
        var data = [account];
        this.call_native('registerAccount', data, callback);
    }

    AlibabaCloudPlugin.prototype.unRegisterAccount = function(account, callback) {
        var data = [account];
        this.call_native('unRegisterAccount', data, callback);
    }

    AlibabaCloudPlugin.prototype.registerTag = function(tag, callback) {
        var data = [tag];
        this.call_native('registerTag', data, null);
    }

    AlibabaCloudPlugin.prototype.unRegisterTag = function(tag, callback) {
        var data = [tag];
        this.call_native('unRegisterTag', data, callback);
    }

    AlibabaCloudPlugin.prototype.listTags = function(callback) {
        var data = [];
        this.call_native('listTags', data, callback);
    }

    AlibabaCloudPlugin.prototype.registerAlias = function(alias, callback) {
        var data = [alias];
        this.call_native('registerAlias', data, callback);
    }

    AlibabaCloudPlugin.prototype.unRegisterAlias = function(alias, callback) {
        var data = [alias];
        this.call_native('unRegisterAlias', data, callback);
    }

    AlibabaCloudPlugin.prototype.listAliases = function(alias, callback) {
        var data = [];
        this.call_native('listAliases', data, callback);
    }

    AlibabaCloudPlugin.prototype.addLocalNotification = function(delayTime, content,
        badge, notificationID, extras) {
        var data = [delayTime, content, badge, notificationID, extras]
        this.call_native('setLocalNotification', data, null)
    }

    AlibabaCloudPlugin.prototype.deleteLocalNotificationWithIdentifierKey = function(
        identifierKey) {
        var data = [identifierKey]
        this.call_native('deleteLocalNotificationWithIdentifierKey', data, null)
    }

    AlibabaCloudPlugin.prototype.clearAllLocalNotifications = function(callback) {
        var data = []
        this.call_native('clearAllLocalNotifications', data, callback)
    }

    AlibabaCloudPlugin.prototype.getApplicationIconBadgeNumber = function(callback) {
        this.call_native('getApplicationIconBadgeNumber', [], callback)
    }

    AlibabaCloudPlugin.prototype.setApplicationIconBadgeNumber = function(badge, callback) {
        this.call_native('setApplicationIconBadgeNumber', [badge], callback)
    }


    // 判断系统设置中是否对本应用启用通知。
    // iOS: 返回值如果大于 0，代表通知开启；0: 通知关闭。
    //		UIRemoteNotificationTypeNone    = 0,
    //    	UIRemoteNotificationTypeBadge   = 1 << 0,
    //    	UIRemoteNotificationTypeSound   = 1 << 1,
    //    	UIRemoteNotificationTypeAlert   = 1 << 2,
    //    	UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,
    // Android: 返回值 1 代表通知启用、0: 通知关闭。
    AlibabaCloudPlugin.prototype.getUserNotificationSettings = function(callback) {
        this.call_native('getUserNotificationSettings', [], callback)
    }

    /**
     * 用于在 Android 6.0 及以上系统，申请一些权限
     * 具体可看：http://docs.jpush.io/client/android_api/#android-60
     */
    AlibabaCloudPlugin.prototype.requestPermission = function(callback) {
        if (device.platform == 'Android') {
            this.call_native('requestPermission', [], callback)
        }
    }

    AlibabaCloudPlugin.prototype.receiveNotificationObservable = function(callback) {
        this.call_native('receiveNotificationObservable', [], callback)
    }

    AlibabaCloudPlugin.prototype.openNotificationObservable = function(callback) {
        this.call_native('openNotificationObservable', [], callback)
    }

    if (!window.plugins) {
        window.plugins = {}
    }

    if (!window.plugins.pushPlugin) {
        window.plugins.pushPlugin = new AlibabaCloudPlugin()
    }

    module.exports = new AlibabaCloudPlugin()
